package com.atguigu.gmall.feign.search;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gmall.model.search.Goods;
import com.atguigu.gmall.model.search.vo.SearchParamsVO;
import com.atguigu.gmall.model.search.vo.SearchResultVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("service-search")
@RequestMapping("/api/inner/search")
public interface SearchFeignClient {

    /**
     * 在es中保存商品数据
     *
     * @param goods
     * @return
     */
    @PostMapping("/save")
    public Result saveGoods(@RequestBody Goods goods);

    /**
     * 在es中移除数据
     * @param skuId
     * @return
     */
    @DeleteMapping("/delete/{skuId}")
    public Result delGoods(@PathVariable Long skuId);


    /**
     * 检索
     * @param param
     * @return
     */
    @PostMapping("/search")
    Result<SearchResultVo> search(SearchParamsVO param);

    /**
     * 修改浏览量
     * @param skuId
     * @param hotScore
     * @return
     */
    @GetMapping("/incrHotScore/{skuId}/{hotScore}")
    public Result incrHotScore(@PathVariable Long skuId, @PathVariable Long hotScore);

}
